function GridCheck(row) {
	if (typeof(document.TRANSProperties.check[row]) == 'undefined') {
	field = document.TRANSProperties.check;
	fieldVal = document.TRANSProperties.Out;
	fieldVel = document.TRANSProperties.In;
	} else {
	field = document.TRANSProperties.check[row];
	fieldVal = document.TRANSProperties.Out[row];
	fieldVel = document.TRANSProperties.In[row];
	}
	SumCard = document.TRANSProperties.SumCard;
	SumValues = document.TRANSProperties.SumValues;
	SumEnviado = document.TRANSProperties.SumEnviado;
	if (field.checked == true) {
	document.TRANSProperties.SumValues.value = (parseFloat(SumValues.value)+parseFloat(fieldVal.value)).toFixed(2);
	document.TRANSProperties.SumEnviado.value = (parseFloat(SumEnviado.value)+parseFloat(fieldVel.value)).toFixed(2);
	document.TRANSProperties.SumCard.value = parseFloat(SumCard.value)+1;
	} else {
	document.TRANSProperties.SumValues.value = (parseFloat(SumValues.value)-parseFloat(fieldVal.value)).toFixed(2);
	document.TRANSProperties.SumEnviado.value = (parseFloat(SumEnviado.value)-parseFloat(fieldVel.value)).toFixed(2);
	document.TRANSProperties.SumCard.value = parseFloat(SumCard.value)-1;
	}
	$valu = '';
	$len = document.TRANSProperties.check.length;
	if (typeof(document.TRANSProperties.check[row]) == 'undefined') {
	$valu = $valu+document.TRANSProperties.check.value+',';
	}
	for ($i = 0; $i < $len; $i++) {
		if (document.TRANSProperties.check[$i].checked == true) {
		$valu = $valu+document.TRANSProperties.check[$i].value+',';
		}
	}
	document.TRANSProperties.POOL.value = $valu;
	
}
function GridCheckAll() {
	field = document.TRANSProperties.checkALL;
	SumCard = document.TRANSProperties.SumCard;
	SumValues = document.TRANSProperties.SumValues;
	SumEnviado = document.TRANSProperties.SumEnviado;
	$fieldVal = document.TRANSProperties.Out;
	$fieldVel = document.TRANSProperties.In;
	$valu = '';
	$SumVal = 0;
	$SumCar = 0;
	$SumIn = 0;
	if (field.checked == true) {
	
	if (typeof(document.TRANSProperties.check.length) == 'undefined') {
		$len = 1;
		document.TRANSProperties.check.checked = true;
		$valu = $valu+document.TRANSProperties.check.value+',';
		$SumVal = parseFloat($fieldVal.value)+parseFloat($SumVal);
		$SumIn = parseFloat($fieldVel.value)+parseFloat($SumIn);
	} else {
		$len = document.TRANSProperties.check.length;
		for ($i = 0; $i < $len; $i++) {
		document.TRANSProperties.check[$i].checked = true;
		$valu = $valu+document.TRANSProperties.check[$i].value+',';
		$SumVal = parseFloat($fieldVal[$i].value)+parseFloat($SumVal);
		$SumIn = parseFloat($fieldVel[$i].value)+parseFloat($SumIn);
		}
	}
		$SumCar = $len;
	} else {
	
	if (typeof(document.TRANSProperties.check.length) == 'undefined') {

		document.TRANSProperties.check.checked = false;
	} else {
		for ($i = 0; $i < $len; $i++) {
		document.TRANSProperties.check[$i].checked = false;
		}
	}

	}
	document.TRANSProperties.SumEnviado.value = $SumIn.toFixed(2);
	document.TRANSProperties.SumValues.value = $SumVal.toFixed(2);
	document.TRANSProperties.SumCard.value = $SumCar;
	document.TRANSProperties.POOL.value = $valu;
}
function FormGridCheck(FromID,row) {
	if (typeof(document.getElementById(FromID).check[row]) == 'undefined') {
	field = document.getElementById(FromID).check;
	fieldVel = document.getElementById(FromID).In;
	} else {
	field = document.getElementById(FromID).check[row];
	fieldVel = document.getElementById(FromID).In[row];
	}
	SumCard = document.getElementById(FromID).SumCard;
	SumEnviado = document.getElementById(FromID).SumEnviado;
	if (field.checked == true) {
	document.getElementById(FromID).SumEnviado.value = (parseFloat(SumEnviado.value)+parseFloat(fieldVel.value)).toFixed(2);
	document.getElementById(FromID).SumCard.value = parseFloat(SumCard.value)+1;
	} else {
	document.getElementById(FromID).SumEnviado.value = (parseFloat(SumEnviado.value)-parseFloat(fieldVel.value)).toFixed(2);
	document.getElementById(FromID).SumCard.value = parseFloat(SumCard.value)-1;
	}
	$valu = '';
	$len = document.getElementById(FromID).check.length;
	if (typeof(document.getElementById(FromID).check[row]) == 'undefined') {
	$valu = $valu+document.getElementById(FromID).check.value+',';
	}
	for ($i = 0; $i < $len; $i++) {
		if (document.getElementById(FromID).check[$i].checked == true) {
		$valu = $valu+document.getElementById(FromID).check[$i].value+',';
		}
	}
	document.getElementById(FromID).POOL.value = $valu;

}
function FormGridCheckAll(FromID) {
	field = document.getElementById(FromID).checkALL;
	$len = document.getElementById(FromID).check.length;
	SumCard = document.getElementById(FromID).SumCard;
	SumEnviado = document.getElementById(FromID).SumEnviado;
	$fieldVel = document.getElementById(FromID).In;
	$valu = '';
	$SumCar = 0;
	$SumIn = 0;
	if (field.checked == true) {
		for ($i = 0; $i < $len; $i++) {
		document.getElementById(FromID).check[$i].checked = true;
		$valu = $valu+document.getElementById(FromID).check[$i].value+',';
		$SumIn = parseFloat($fieldVel[$i].value)+parseFloat($SumIn);
		}
		$SumCar = $len;
	} else {
		for ($i = 0; $i < $len; $i++) {
		document.getElementById(FromID).check[$i].checked = false;
		}
	}
	document.getElementById(FromID).SumEnviado.value = $SumIn.toFixed(2);
	document.getElementById(FromID).SumCard.value = $SumCar;
	document.getElementById(FromID).POOL.value = $valu;
}
function updateCorr() {
   if(document.getElementById('FraModo').value==1){
		if (document.FMORDNGEN.CORR.value < 1 && document.FMORDNGEN.POOL.value != '') {
			document.FMORDNGEN.Generate.disabled = false;
			document.FMORDNGEN.Redirect.disabled = true;
		} else if (document.FMORDNGEN.CORR.value != '' && document.FMORDNGEN.POOL.value != '') {
			document.FMORDNGEN.Generate.disabled = true;
			document.FMORDNGEN.Redirect.disabled = false;
		} else {
			document.FMORDNGEN.Generate.disabled = true;
			document.FMORDNGEN.Redirect.disabled = true;
		}
   }else{
		if (document.FMORDNGEN.POOL.value == '') {
			document.FMORDNGEN.Generate.disabled = true;
			document.FMORDNGEN.Redirect.disabled = true;
		} else {
			if(document.FMORDNGEN.FrwOrigen.options[document.FMORDNGEN.FrwOrigen.selectedIndex].value>0){
				document.FMORDNGEN.Generate.disabled = true;
				document.FMORDNGEN.Redirect.disabled = false;
			}else{
				document.FMORDNGEN.Generate.disabled = false;
				document.FMORDNGEN.Redirect.disabled = true;
			}
		}
   }
}
function updateTrnsCorr() {

	if (document.FMTRANSGEN.CORR.value != '' && document.FMTRANSGEN.POOL.value != '') {
	document.FMTRANSGEN.Generate.disabled = false;
	} else {
	document.FMTRANSGEN.Generate.disabled = true;
	}
}
function calcula_cambios($input){
	$div = document.getElementById('htr_Divisa').value;
	$loc = document.getElementById('htr_NacLocal').value;
	$iprc = 1+document.getElementById('req_Percent').value/100;
	$cmb = document.getElementById('htr_Tasa').value;

	$camb_calculado = $div*$loc;
	$camb_final = $camb_calculado*$iprc;
	document.getElementById('htr_Cambio').value = $camb_calculado;
	if($input != 'htr_Tasa') {
		$camb_final = $camb_calculado*$iprc;
		document.getElementById('htr_Tasa').value=$camb_final;
		$iprc = $iprc-1;
	} else {
		$iprc = ($camb_calculado/$cmb-1)*100;
		document.getElementById('req_Percent').value=$iprc;
	}
	if($iprc<0 || $iprc>9999 || isNaN($camb_final)){document.SetRates.PRSVRT.disabled=true;}else{document.SetRates.PRSVRT.disabled=false;}
}